package com.bobo.model;

import java.awt.*;

/**
 * @Author: bobobo
 * @Date: 2019/9/3 11:06
 * @Version：1.0
 */
public class MergeSortData {
    public int[] numbers;
    public int l,r;
    public int mergeIndex;

    public MergeSortData(int N,int randomBound){
        numbers = new int[N];
        for (int i = 0; i < N; i ++ )
            numbers[i] = (int) (Math.random()*randomBound) + 1;
    }

    public int N(){
        return numbers.length;
    }

    public int get(int index){
        if (index < 0 || index >= N())
            throw new IllegalArgumentException("索引越界");
        return numbers[index];
    }

    public void swap(int i,int j){
        if (i < 0 || i >= N() || j < 0 || j >= N())
            throw new IllegalArgumentException("索引越界");
        int t = numbers[i];
        numbers[i] = numbers[j];
        numbers[j] = t;
    }
}
